package aad.storyboard.model;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.ColorMatrix;

public class BlackFader implements Fader{

Bitmap fadeBitmap;
	
	public BlackFader(Bitmap btm)
	{
		fadeBitmap = btm;   	
	}
	
	
	@Override
	public void fade(ColorMatrix cm, int contrast) {
		fadeBitmap.eraseColor(Color.BLACK); 
		setBlackAlpha(cm, contrast);

	}


	private void setBlackAlpha(ColorMatrix cm, int contrast) {
		 float scale = contrast - 1.f; 
      	 cm.set(new float[] {
               0, 0, 0, 0, 0, 
               0, 0, 0, 0, 0,
               0, 0, 0, 0, 0, 
               0, 0, 0, 0, scale});
		
	}

}
